# -*- coding: utf8 -*-
import json
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest

# 创建AcsClient实例
client = AcsClient(
   "LTAIQPy1edB4EYtg",
   "TF7D61AhVJ5qe5BcJmAsxjxjfVSg5Z",
   "cn-shanghai"
);

def getToken():
    # 创建request，并设置参数。
    request = CommonRequest()
    request.set_method('POST')
    request.set_domain('nls-meta.cn-shanghai.aliyuncs.com')
    request.set_version('2019-02-28')
    request.set_action_name('CreateToken')
    response = client.do_action_with_exception(request)

    obj = json.loads(response)
    return obj.get("Token").get("Id")


# print(getToken())

